import React from 'react'
import store from "../../store/store"
import { getMovieAction } from '../../store/actions/movieAction'

export default function Movie() {
  //由于更改为合并中间件所以取值有所改变
  const { count } = store.getState().count
  const { movieList } = store.getState().movie
 
  const getMovieHandle =()=>{
    // console.log(1);
    //这里要点击发送请求，单独写到一个api，然后放到action单独处理
    store.dispatch(getMovieAction())
  }

  console.log(movieList);
  return (
    <div>
         <h1>我是Movie组件</h1>
      <p>我收到的Count组件的值是 {count }</p>

      <button onClick={getMovieHandle}>点击获取所有电影</button>

      <ul>
        {
          movieList.map(item => {
            return <li key={item.tvId}>{item.albumName}</li>
          })
        }
      </ul>
    </div>
  )
}
